<h1>Video Albums</h1>
<div align = "right"><%= link_to "New Video Album", new_video_album_path %></div>
<% if !@video_albums.blank? %>
	<table border=1 class="list_table_2">
		<tr>
			<th>Name</th>
			<th colspan = "2">Manage Video</th>
			<th>Position</th>
			<th colspan = "3">Action</th>
			<% if current_user.role.name == "admin" %>
              <th>user name</th>
			<% end %>
		</tr>
		<% @video_albums.each_with_index do | video_album,index | %>
			<tr>
				<td><%= video_album.name %></td>				
				<td><%= link_to "Add a video", :controller => "videos", :action => "new", :id =>video_album  %></td>				
				<td><%= link_to "Video List",:controller => "videos", :action => "index", :id =>video_album  %></td>				
				<td><%= link_to image_tag("upside_arrow.jpg",:width => '18px'),:action=>"change_position",:id=>video_album.id,:change_id=>@video_albums[index.to_i - 1].id if index.to_i != 0 %>&nbsp;<%= link_to image_tag("downside_arrow.jpg",:width => '18px'),:action=>"change_position",:id=>video_album.id,:change_id=> @video_albums[index.to_i + 1].id if !@video_albums[index.to_i + 1].blank?%>
                </td>
				<td width = "5"><%= link_to image_tag("view_icon.png", :alt=>"View",:border=>"0",  :title=>"View"), video_album %></td>
				<td width = "5"><%= link_to image_tag("Text-Edit-Icon.png", :alt=>"Edit",:border=>"0",  :title=>"Edit"), edit_video_album_path(video_album) %></td>
				<td width = "5"><%= link_to image_tag("notebook_delete.png", :alt=>"Delete",:border=>"0",  :title=>"Delete"), video_album, :confirm => 'Are you sure?', :method => :delete %></td>
				<% if current_user.role.name == "admin" %>
                  <td><%= video_album.user.login if !video_album.user.blank? %></td>
			    <% end %>
			</tr>
		<% end %>
	</table>
<% else %>
No Record Found
<% end %>

